{% comment %}
  The language chooser is a drop down list which displays the relevant flag to the left.
  If JavaScript is enabled, then it will automatically redirect to the relevant translation when changed.
  If the user has JavaScript disabled, then it will show a submit button, and the .htaccess file will rewrite
  the incoming "?lang=..." query parameter to the correct translated path.
{% endcomment %}

{% assign strings = site.data.strings.sidebars.lang %}

<form action="{{site.baseurl}}{{ page.url }}" method="get">

  <select id="language-chooser-select" name="lang" autocomplete="off">
    {% for lang in site.languages %}
      <option value="{{ lang }}" {% if lang == site.active_lang %}selected="selected"{% endif %}>
        {{ site.data.languagenames[lang] }}
      </option>
    {% endfor %}
  </select>

  <script src="{{site.baseurl}}/js/sidebar-lang.js"></script>

  <noscript>
    <input id="language-chooser-submit" type="submit" value="{{ strings.change }}" />
  </noscript>

</form>
